<template>
  <div class="foodBarbecue">
    <barbecue-header/>
    <barbecue-logo/>
    <barbecue-recommend :list="barbecueRecommendList "/>
    <barbecue-footer/>
  </div>
</template>

<script>
import BarbecueHeader from "./components/BarbecueHeader.vue";
import BarbecueLogo from "./components/BarbecueLogo.vue";
import BarbecueRecommend from "./components/BarbecueRecommend.vue";
import BarbecueFooter from "./components/BarbecueFooter.vue";
import axios from "axios";
export default {
  name: "foodBarbecue",
  components: {
    BarbecueHeader,
    BarbecueLogo,
    BarbecueRecommend,
    BarbecueFooter
  },
  data: function() {
    return {
      barbecueRecommendList: []
    };
  },
  mounted() {
    this.getHomeApiInfo();
  },
  methods: {
    getHomeApiInfo() {
      axios
        .get("/mock/Food/barbecue.json")
        .then(this.getHomeResponseInfo, function(success) {
          console.log("请求json数据成功");
          console.log(success);
        })
        .catch(function(err) {
          console.log("请求json数据失败");
          console.log(err);
        });
    },
    getHomeResponseInfo(response) {
      console.log(response.data);
      let res = response.data;
      if (res.success && res.dataList) {
        const barbecueData = res.dataList;
        this.barbecueRecommendList = barbecueData.BarbecueRecommedLists;
      }
    }
  }
};
</script>          